<!-- HTML header for doxygen 1.8.18-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=9" />
    <meta name="generator" content="Doxygen 1.8.18" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Limit Order Book: include/limit_order_book.hpp Source File</title>
    <link href="tabs.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript" src="dynsections.js"></script>
    <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
    <script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
    <link href="html_stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div id="top">
        <!-- do not remove this div, it is closed by doxygen! -->
        <div id="titlearea">
            <table cellspacing="0" cellpadding="0">
                <tbody>
                    <tr style="height: 56px;">
                        <td id="projectalign" style="padding-left: 0.5em;">
                            <div id="projectname">Limit Order Book
                                &#160;<span id="projectnumber">2.0.0</span>
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">limit_order_book.hpp</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">// An order book for managing Limit / Order objects in a continuous double auction.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">// Copyright (c) 2020 Christian Kauten</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">// Permission is hereby granted, free of charge, to any person obtaining a copy</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment">// of this software and associated documentation files (the &quot;Software&quot;), to deal</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment">// in the Software without restriction, including without limitation the rights</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment">// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment">// copies of the Software, and to permit persons to whom the Software is</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment">// furnished to do so, subject to the following conditions:</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment">// The above copyright notice and this permission notice shall be included in all</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment">// copies or substantial portions of the Software.</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment">// THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment">// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment">// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment">// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment">// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment">// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment">// SOFTWARE.</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160; </div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="preprocessor">#ifndef LOB_LIMIT_ORDER_BOOK_HPP_</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor">#define LOB_LIMIT_ORDER_BOOK_HPP_</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160; </div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor">#include &quot;limit_tree.hpp&quot;</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &lt;unordered_map&gt;</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="preprocessor">#include &lt;tuple&gt;</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160; </div>
<div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="namespace_l_o_b.html">   33</a></span>&#160;<span class="keyword">namespace </span><a class="code" href="namespace_l_o_b.html">LOB</a> {</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160; </div>
<div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="namespace_l_o_b.html#a55b6f5940501ff6a6f8de06dfc18852c">   36</a></span>&#160;<span class="keyword">typedef</span> std::unordered_map&lt;UID, Order&gt; <a class="code" href="namespace_l_o_b.html#a55b6f5940501ff6a6f8de06dfc18852c">UIDOrderMap</a>;</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160; </div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html">   43</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_l_o_b_1_1_limit_order_book.html">LimitOrderBook</a> {</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    <a class="code" href="struct_l_o_b_1_1_limit_tree.html">LimitTree&lt;Side::Sell&gt;</a> sells;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    <a class="code" href="struct_l_o_b_1_1_limit_tree.html">LimitTree&lt;Side::Buy&gt;</a> buys;</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;    <a class="code" href="namespace_l_o_b.html#a55b6f5940501ff6a6f8de06dfc18852c">UIDOrderMap</a> orders;</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160; </div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a36759fa79596b1d2d9e2af07ab8954fd">   54</a></span>&#160;    <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a36759fa79596b1d2d9e2af07ab8954fd">LimitOrderBook</a>() : sells(), buys(), orders() { }</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160; </div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a25db4d825c1f8504e8be5dae532dbb87">   57</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a25db4d825c1f8504e8be5dae532dbb87">clear</a>() {</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;        sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#af889225100ab93c596081ceec4ffb474">clear</a>();</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;        buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#af889225100ab93c596081ceec4ffb474">clear</a>();</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;        orders.clear();</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    }</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160; </div>
<div class="line"><a name="l00069"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a5c93f74cfed393b21ef5b88787b95b79">   69</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a5c93f74cfed393b21ef5b88787b95b79">limit_sell</a>(<a class="code" href="namespace_l_o_b.html#a482ac950a9cb23fdb93c66d6117a8f74">UID</a> order_id, <a class="code" href="namespace_l_o_b.html#a1d5eee8595d35bc6f2b8372e44cd8dd7">Quantity</a> quantity, <a class="code" href="namespace_l_o_b.html#a0170482547b909e8a53b5ae42d18e23a">Price</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>) {</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;        <span class="comment">// put the order into the map</span></div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;        orders.emplace(std::piecewise_construct,</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;            std::forward_as_tuple(order_id),</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;            std::forward_as_tuple(order_id, Side::Sell, quantity, <a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>)</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;        );</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;        <span class="keywordflow">if</span> (buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a> != <span class="keyword">nullptr</span> &amp;&amp; price &lt;= buys.best-&gt;key) {  <span class="comment">// crosses</span></div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;            <span class="comment">// place a market order with the limit price</span></div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;            buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a8dd611700d87618f14fdada0113272a5">market</a>(&amp;orders.at(order_id), [&amp;](<a class="code" href="namespace_l_o_b.html#a482ac950a9cb23fdb93c66d6117a8f74">UID</a> uid) { orders.erase(uid); });</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;            <span class="keywordflow">if</span> (orders.at(order_id).quantity == 0) {  <span class="comment">// order filled</span></div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;                orders.erase(order_id);</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;                <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;            }</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;        }</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;        sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#ac4a8791f4b50ed29152d42940c3be06d">limit</a>(&amp;orders.at(order_id));</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    }</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160; </div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a1fc2e7e8d44b57c21be04aea96a208ef">   92</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a1fc2e7e8d44b57c21be04aea96a208ef">limit_buy</a>(<a class="code" href="namespace_l_o_b.html#a482ac950a9cb23fdb93c66d6117a8f74">UID</a> order_id, <a class="code" href="namespace_l_o_b.html#a1d5eee8595d35bc6f2b8372e44cd8dd7">Quantity</a> quantity, <a class="code" href="namespace_l_o_b.html#a0170482547b909e8a53b5ae42d18e23a">Price</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>) {</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;        <span class="comment">// put the order into the map</span></div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;        orders.emplace(std::piecewise_construct,</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;            std::forward_as_tuple(order_id),</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;            std::forward_as_tuple(order_id, Side::Buy, quantity, <a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>)</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;        );</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;        <span class="keywordflow">if</span> (sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a> != <span class="keyword">nullptr</span> &amp;&amp; <a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a> &gt;= sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a>-&gt;key) {  <span class="comment">// crosses</span></div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;            <span class="comment">// place a market order with the limit price</span></div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;            sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a8dd611700d87618f14fdada0113272a5">market</a>(&amp;orders.at(order_id), [&amp;](<a class="code" href="namespace_l_o_b.html#a482ac950a9cb23fdb93c66d6117a8f74">UID</a> uid) { orders.erase(uid); });</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;            <span class="keywordflow">if</span> (orders.at(order_id).quantity == 0) {  <span class="comment">// order filled</span></div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;                orders.erase(order_id);</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;                <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;            }</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;        }</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;        buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#ac4a8791f4b50ed29152d42940c3be06d">limit</a>(&amp;orders.at(order_id));</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    }</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160; </div>
<div class="line"><a name="l00116"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a0701f5738fba67af36a47983c38dd9c1">  116</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a0701f5738fba67af36a47983c38dd9c1">limit</a>(<a class="code" href="namespace_l_o_b.html#ac0757a974349160aa795b45451948db6">Side</a> side, <a class="code" href="namespace_l_o_b.html#a482ac950a9cb23fdb93c66d6117a8f74">UID</a> order_id, <a class="code" href="namespace_l_o_b.html#a1d5eee8595d35bc6f2b8372e44cd8dd7">Quantity</a> quantity, <a class="code" href="namespace_l_o_b.html#a0170482547b909e8a53b5ae42d18e23a">Price</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>) {</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;        <span class="keywordflow">switch</span> (side) {  <span class="comment">// send the order to the appropriate side</span></div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;            <span class="keywordflow">case</span> Side::Sell: <span class="keywordflow">return</span> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a5c93f74cfed393b21ef5b88787b95b79">limit_sell</a>(order_id, quantity, <a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>);</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;            <span class="keywordflow">case</span> Side::Buy:  <span class="keywordflow">return</span> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a1fc2e7e8d44b57c21be04aea96a208ef">limit_buy</a>(order_id, quantity, <a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>);</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;        }</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    }</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160; </div>
<div class="line"><a name="l00128"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a967430745df666a98b00d169bf14cee3">  128</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a967430745df666a98b00d169bf14cee3">has</a>(<a class="code" href="namespace_l_o_b.html#a482ac950a9cb23fdb93c66d6117a8f74">UID</a> order_id)<span class="keyword"> const </span>{ <span class="keywordflow">return</span> orders.count(order_id); }</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160; </div>
<div class="line"><a name="l00135"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a47a0fe3f7ac4da1b6ce80e0902ef0473">  135</a></span>&#160;    <span class="keyword">inline</span> <span class="keyword">const</span> <a class="code" href="struct_l_o_b_1_1_order.html">Order</a>&amp; <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a47a0fe3f7ac4da1b6ce80e0902ef0473">get</a>(<a class="code" href="namespace_l_o_b.html#a482ac950a9cb23fdb93c66d6117a8f74">UID</a> order_id) { <span class="keywordflow">return</span> orders.at(order_id); }</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160; </div>
<div class="line"><a name="l00141"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#af94adea77f7dad19b4dd061d69a96d91">  141</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#af94adea77f7dad19b4dd061d69a96d91">cancel</a>(<a class="code" href="namespace_l_o_b.html#a482ac950a9cb23fdb93c66d6117a8f74">UID</a> order_id) {</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;        <span class="keyword">auto</span> order = &amp;orders.at(order_id);</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;        <span class="keywordflow">switch</span> (order-&gt;side) {  <span class="comment">// remove the order from the appropriate side</span></div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;            <span class="keywordflow">case</span> Side::Sell: { sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a1098e1bb85b42a2e7ea550a8a3a7d56b">cancel</a>(order); <span class="keywordflow">break</span>; }</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;            <span class="keywordflow">case</span> Side::Buy:  { buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a1098e1bb85b42a2e7ea550a8a3a7d56b">cancel</a>(order); <span class="keywordflow">break</span>; }</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;        }</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;        orders.erase(order_id);</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;    }</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160; </div>
<div class="line"><a name="l00155"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#abbc7458a5a780d29e57122bb4d233db5">  155</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#abbc7458a5a780d29e57122bb4d233db5">reduce</a>(<a class="code" href="namespace_l_o_b.html#a482ac950a9cb23fdb93c66d6117a8f74">UID</a> order_id, <a class="code" href="namespace_l_o_b.html#a1d5eee8595d35bc6f2b8372e44cd8dd7">Quantity</a> quantity) {</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;        <span class="keyword">auto</span> order = &amp;orders.at(order_id);</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;        <span class="keywordflow">if</span> (quantity &gt; order-&gt;quantity) {  <span class="comment">// trying to remove more than available</span></div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;            <span class="keywordflow">throw</span> <span class="stringliteral">&quot;trying to remove &quot;</span> +</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;                std::to_string(quantity) +</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;                <span class="stringliteral">&quot; from order with &quot;</span> +</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;                std::to_string(order-&gt;quantity) +</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;                <span class="stringliteral">&quot; available!&quot;</span>;</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;        }</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;        <span class="comment">// remove the quantity from the order and limit</span></div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;        order-&gt;quantity -= quantity;</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;        order-&gt;limit-&gt;volume -= quantity;</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;        <span class="keywordflow">switch</span> (order-&gt;side) {  <span class="comment">// remove the order from the appropriate side</span></div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;            <span class="keywordflow">case</span> Side::Sell: { sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a64a5025b0f65c36c1a6f2d4056543ea7">volume</a> -= quantity; <span class="keywordflow">break</span>; }</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;            <span class="keywordflow">case</span> Side::Buy:  { buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a64a5025b0f65c36c1a6f2d4056543ea7">volume</a> -= quantity; <span class="keywordflow">break</span>; }</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;        }</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;        <span class="keywordflow">if</span> (order-&gt;quantity == 0) {  <span class="comment">// remove the order if there is no quantity left</span></div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;            <span class="keywordflow">switch</span> (order-&gt;side) {  <span class="comment">// remove the order from the appropriate side</span></div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;                <span class="keywordflow">case</span> Side::Sell: { sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a1098e1bb85b42a2e7ea550a8a3a7d56b">cancel</a>(order); <span class="keywordflow">break</span>; }</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;                <span class="keywordflow">case</span> Side::Buy:  { buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a1098e1bb85b42a2e7ea550a8a3a7d56b">cancel</a>(order); <span class="keywordflow">break</span>; }</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;            }</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;            orders.erase(order_id);</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;        }</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;    }</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160; </div>
<div class="line"><a name="l00185"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#abc553a89a69dba889a5d338645376dce">  185</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#abc553a89a69dba889a5d338645376dce">market_sell</a>(<a class="code" href="namespace_l_o_b.html#a482ac950a9cb23fdb93c66d6117a8f74">UID</a> order_id, <a class="code" href="namespace_l_o_b.html#a1d5eee8595d35bc6f2b8372e44cd8dd7">Quantity</a> quantity) {</div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;        <a class="code" href="struct_l_o_b_1_1_order.html">Order</a> order{order_id, Side::Sell, quantity, 0};</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;        buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a8dd611700d87618f14fdada0113272a5">market</a>(&amp;order, [&amp;](<a class="code" href="namespace_l_o_b.html#a482ac950a9cb23fdb93c66d6117a8f74">UID</a> uid) { orders.erase(uid); });</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;    }</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160; </div>
<div class="line"><a name="l00195"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a64a58b51c467ef7ffcf97d806f5282ca">  195</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a64a58b51c467ef7ffcf97d806f5282ca">market_buy</a>(<a class="code" href="namespace_l_o_b.html#a482ac950a9cb23fdb93c66d6117a8f74">UID</a> order_id, <a class="code" href="namespace_l_o_b.html#a1d5eee8595d35bc6f2b8372e44cd8dd7">Quantity</a> quantity) {</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;        <a class="code" href="struct_l_o_b_1_1_order.html">Order</a> order{order_id, Side::Buy, quantity, 0};</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;        sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a8dd611700d87618f14fdada0113272a5">market</a>(&amp;order, [&amp;](<a class="code" href="namespace_l_o_b.html#a482ac950a9cb23fdb93c66d6117a8f74">UID</a> uid) { orders.erase(uid); });</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;    }</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160; </div>
<div class="line"><a name="l00206"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a1c7a81804946e116e376c550154a092d">  206</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a1c7a81804946e116e376c550154a092d">market</a>(<a class="code" href="namespace_l_o_b.html#ac0757a974349160aa795b45451948db6">Side</a> side, <a class="code" href="namespace_l_o_b.html#a482ac950a9cb23fdb93c66d6117a8f74">UID</a> order_id, <a class="code" href="namespace_l_o_b.html#a1d5eee8595d35bc6f2b8372e44cd8dd7">Quantity</a> quantity) {</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;        <span class="keywordflow">switch</span> (side) {  <span class="comment">// send the market order to the appropriate side</span></div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;            <span class="keywordflow">case</span> Side::Sell: { <a class="code" href="class_l_o_b_1_1_limit_order_book.html#abc553a89a69dba889a5d338645376dce">market_sell</a>(order_id, quantity); <span class="keywordflow">break</span>; }</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;            <span class="keywordflow">case</span> Side::Buy:  { <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a64a58b51c467ef7ffcf97d806f5282ca">market_buy</a>(order_id, quantity); <span class="keywordflow">break</span>; }</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;        }</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;    }</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160; </div>
<div class="line"><a name="l00217"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#afd8dd7bccdcffee233c780fe445e1c01">  217</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a0170482547b909e8a53b5ae42d18e23a">Price</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#afd8dd7bccdcffee233c780fe445e1c01">best_sell</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;        <span class="keywordflow">if</span> (sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a> == <span class="keyword">nullptr</span>)</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;            <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;        <span class="keywordflow">return</span> sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a>-&gt;key;</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;    }</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160; </div>
<div class="line"><a name="l00227"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a7b2ad9b29403af9a5079176aefb009ce">  227</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a0170482547b909e8a53b5ae42d18e23a">Price</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a7b2ad9b29403af9a5079176aefb009ce">best_buy</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;        <span class="keywordflow">if</span> (buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a> == <span class="keyword">nullptr</span>)</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;            <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;        <span class="keywordflow">return</span> buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a>-&gt;key;</div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;    }</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160; </div>
<div class="line"><a name="l00238"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a387f091324bb052d38c8532ab508ab7c">  238</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a0170482547b909e8a53b5ae42d18e23a">Price</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a387f091324bb052d38c8532ab508ab7c">best</a>(<a class="code" href="namespace_l_o_b.html#ac0757a974349160aa795b45451948db6">Side</a> side)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;        <span class="keywordflow">switch</span> (side) {</div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;            <span class="keywordflow">case</span> Side::Sell: { <span class="keywordflow">return</span> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#afd8dd7bccdcffee233c780fe445e1c01">best_sell</a>(); }</div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;            <span class="keywordflow">case</span> Side::Buy:  { <span class="keywordflow">return</span> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a7b2ad9b29403af9a5079176aefb009ce">best_buy</a>();  }</div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;        }</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;    }</div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160; </div>
<div class="line"><a name="l00249"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">  249</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a0170482547b909e8a53b5ae42d18e23a">Price</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;        <span class="keywordflow">if</span> (sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a> == <span class="keyword">nullptr</span> &amp;&amp; buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a> == <span class="keyword">nullptr</span>)  <span class="comment">// empty book</span></div>
<div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;            <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;        <span class="keywordflow">if</span> (sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a> == <span class="keyword">nullptr</span>)  <span class="comment">// no sell orders</span></div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;            <span class="keywordflow">return</span> buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a>-&gt;key;</div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;        <span class="keywordflow">if</span> (buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a> == <span class="keyword">nullptr</span>)  <span class="comment">// no buy orders</span></div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;            <span class="keywordflow">return</span> sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a>-&gt;key;</div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;        <span class="comment">// return the midpoint</span></div>
<div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;        <span class="keywordflow">return</span> (sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a>-&gt;key + buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a>-&gt;key) / 2;</div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;    }</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160; </div>
<div class="line"><a name="l00264"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a921ec224ef6f9b7f3033f8d56b452da6">  264</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a0170482547b909e8a53b5ae42d18e23a">Price</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a921ec224ef6f9b7f3033f8d56b452da6">last_best_sell</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a941d1cf3065746647e08bb972f65121b">last_best_price</a>; }</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160; </div>
<div class="line"><a name="l00270"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#ac9bdd886adeb616798dab28ab8e07ab1">  270</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a0170482547b909e8a53b5ae42d18e23a">Price</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#ac9bdd886adeb616798dab28ab8e07ab1">last_best_buy</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a941d1cf3065746647e08bb972f65121b">last_best_price</a>; }</div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160; </div>
<div class="line"><a name="l00277"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a8aba12b5f75a21fe026e85606cbca2fd">  277</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a0170482547b909e8a53b5ae42d18e23a">Price</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a8aba12b5f75a21fe026e85606cbca2fd">last_best</a>(<a class="code" href="namespace_l_o_b.html#ac0757a974349160aa795b45451948db6">Side</a> side)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160;        <span class="keywordflow">switch</span> (side) {</div>
<div class="line"><a name="l00279"></a><span class="lineno">  279</span>&#160;            <span class="keywordflow">case</span> Side::Sell: { <span class="keywordflow">return</span> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a921ec224ef6f9b7f3033f8d56b452da6">last_best_sell</a>(); }</div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;            <span class="keywordflow">case</span> Side::Buy:  { <span class="keywordflow">return</span> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#ac9bdd886adeb616798dab28ab8e07ab1">last_best_buy</a>();  }</div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;        }</div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;    }</div>
<div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160; </div>
<div class="line"><a name="l00288"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#ad69a10a7e1f026a2e055678b493533fa">  288</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a0170482547b909e8a53b5ae42d18e23a">Price</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#ad69a10a7e1f026a2e055678b493533fa">last_price</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;        <span class="keywordflow">return</span> (sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a941d1cf3065746647e08bb972f65121b">last_best_price</a> + buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a941d1cf3065746647e08bb972f65121b">last_best_price</a>) / 2;</div>
<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;    }</div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160; </div>
<div class="line"><a name="l00297"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#aa767c4ecce229b3393159ffd1cf481bb">  297</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a0860e916768a8e3baaadf73c1a6f9c58">Volume</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#aa767c4ecce229b3393159ffd1cf481bb">volume_sell</a>(<a class="code" href="namespace_l_o_b.html#a0170482547b909e8a53b5ae42d18e23a">Price</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;        <span class="keywordflow">return</span> sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a8d6aec814919b377fffeecd6c3919b83">volume_at</a>(<a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>);</div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160;    }</div>
<div class="line"><a name="l00300"></a><span class="lineno">  300</span>&#160; </div>
<div class="line"><a name="l00305"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a7eade388226acdf65eb9804e90339cc3">  305</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a0860e916768a8e3baaadf73c1a6f9c58">Volume</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a7eade388226acdf65eb9804e90339cc3">volume_sell</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a64a5025b0f65c36c1a6f2d4056543ea7">volume</a>; }</div>
<div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160; </div>
<div class="line"><a name="l00311"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#ac03f86cfcc50a37b72c6d7f443c57123">  311</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a0860e916768a8e3baaadf73c1a6f9c58">Volume</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#ac03f86cfcc50a37b72c6d7f443c57123">volume_sell_best</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;        <span class="keywordflow">if</span> (sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a> == <span class="keyword">nullptr</span>) <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;        <span class="keywordflow">return</span> sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a>-&gt;<a class="code" href="struct_l_o_b_1_1_limit.html#a73fcec9f433efd6a506f1c08bf52a233">volume</a>;</div>
<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160;    }</div>
<div class="line"><a name="l00315"></a><span class="lineno">  315</span>&#160; </div>
<div class="line"><a name="l00321"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a7d1612e63e88d3dc75046d3d653f1312">  321</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a0860e916768a8e3baaadf73c1a6f9c58">Volume</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a7d1612e63e88d3dc75046d3d653f1312">volume_buy</a>(<a class="code" href="namespace_l_o_b.html#a0170482547b909e8a53b5ae42d18e23a">Price</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;        <span class="keywordflow">return</span> buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a8d6aec814919b377fffeecd6c3919b83">volume_at</a>(<a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>);</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;    }</div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160; </div>
<div class="line"><a name="l00329"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a23f833cfd794e37a0eb0dc0d1518b832">  329</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a0860e916768a8e3baaadf73c1a6f9c58">Volume</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a23f833cfd794e37a0eb0dc0d1518b832">volume_buy</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a64a5025b0f65c36c1a6f2d4056543ea7">volume</a>; }</div>
<div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160; </div>
<div class="line"><a name="l00335"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#aba2ae20f97a5e485dc04c7eee730b877">  335</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a0860e916768a8e3baaadf73c1a6f9c58">Volume</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#aba2ae20f97a5e485dc04c7eee730b877">volume_buy_best</a>()<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;        <span class="keywordflow">if</span> (buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a> == <span class="keyword">nullptr</span>) <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;        <span class="keywordflow">return</span> buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">best</a>-&gt;<a class="code" href="struct_l_o_b_1_1_limit.html#a73fcec9f433efd6a506f1c08bf52a233">volume</a>;</div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;    }</div>
<div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160; </div>
<div class="line"><a name="l00345"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#ac9b18049862c09ce70c87d679a83bd9f">  345</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a0860e916768a8e3baaadf73c1a6f9c58">Volume</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#ac9b18049862c09ce70c87d679a83bd9f">volume</a>(<a class="code" href="namespace_l_o_b.html#a0170482547b909e8a53b5ae42d18e23a">Price</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;        <span class="keywordflow">return</span> buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a8d6aec814919b377fffeecd6c3919b83">volume_at</a>(<a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>) + sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a8d6aec814919b377fffeecd6c3919b83">volume_at</a>(<a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>);</div>
<div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;    }</div>
<div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160; </div>
<div class="line"><a name="l00353"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a38ef9caa257416d0290749d3e33662e8">  353</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a0860e916768a8e3baaadf73c1a6f9c58">Volume</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a38ef9caa257416d0290749d3e33662e8">volume</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a64a5025b0f65c36c1a6f2d4056543ea7">volume</a> + buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#a64a5025b0f65c36c1a6f2d4056543ea7">volume</a>; }</div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160; </div>
<div class="line"><a name="l00360"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a467bc9491b867ec41ae85a1b93953717">  360</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a98c8cdadc7da7cd760e1a6dede850854">Count</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a467bc9491b867ec41ae85a1b93953717">count_at</a>(<a class="code" href="namespace_l_o_b.html#a0170482547b909e8a53b5ae42d18e23a">Price</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>)<span class="keyword"> const </span>{</div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;        <span class="keywordflow">return</span> buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#ae52da1196e73a756b93634df3940dcaa">count_at</a>(<a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>) + sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#ae52da1196e73a756b93634df3940dcaa">count_at</a>(<a class="code" href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">price</a>);</div>
<div class="line"><a name="l00362"></a><span class="lineno">  362</span>&#160;    }</div>
<div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160; </div>
<div class="line"><a name="l00368"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a3f67e339651390feb7171cea1bbd5c91">  368</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a98c8cdadc7da7cd760e1a6dede850854">Count</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a3f67e339651390feb7171cea1bbd5c91">count_sell</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#ac6f9f6989f2d73a1917c1488252cfaf5">count</a>; }</div>
<div class="line"><a name="l00369"></a><span class="lineno">  369</span>&#160; </div>
<div class="line"><a name="l00374"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a7b32433cbe16525043683dd76b5eebc4">  374</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a98c8cdadc7da7cd760e1a6dede850854">Count</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a7b32433cbe16525043683dd76b5eebc4">count_buy</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#ac6f9f6989f2d73a1917c1488252cfaf5">count</a>; }</div>
<div class="line"><a name="l00375"></a><span class="lineno">  375</span>&#160; </div>
<div class="line"><a name="l00380"></a><span class="lineno"><a class="line" href="class_l_o_b_1_1_limit_order_book.html#a13a16e7cee3c24cf0d80b84440d7f7ac">  380</a></span>&#160;    <span class="keyword">inline</span> <a class="code" href="namespace_l_o_b.html#a98c8cdadc7da7cd760e1a6dede850854">Count</a> <a class="code" href="class_l_o_b_1_1_limit_order_book.html#a13a16e7cee3c24cf0d80b84440d7f7ac">count</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> sells.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#ac6f9f6989f2d73a1917c1488252cfaf5">count</a> + buys.<a class="code" href="struct_l_o_b_1_1_limit_tree.html#ac6f9f6989f2d73a1917c1488252cfaf5">count</a>; }</div>
<div class="line"><a name="l00381"></a><span class="lineno">  381</span>&#160;};</div>
<div class="line"><a name="l00382"></a><span class="lineno">  382</span>&#160; </div>
<div class="line"><a name="l00383"></a><span class="lineno">  383</span>&#160;}  <span class="comment">// namespace LOB</span></div>
<div class="line"><a name="l00384"></a><span class="lineno">  384</span>&#160; </div>
<div class="line"><a name="l00385"></a><span class="lineno">  385</span>&#160;<span class="preprocessor">#endif  // LOB_LIMIT_ORDER_BOOK_HPP_</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="anamespace_l_o_b_html"><div class="ttname"><a href="namespace_l_o_b.html">LOB</a></div><div class="ttdoc">Logic for maintaining a continuous double auction via a limit-order book.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:33</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a1fc2e7e8d44b57c21be04aea96a208ef"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a1fc2e7e8d44b57c21be04aea96a208ef">LOB::LimitOrderBook::limit_buy</a></div><div class="ttdeci">void limit_buy(UID order_id, Quantity quantity, Price price)</div><div class="ttdoc">Add a new buy limit order to the book.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:92</div></div>
<div class="ttc" id="anamespace_l_o_b_html_ac0757a974349160aa795b45451948db6"><div class="ttname"><a href="namespace_l_o_b.html#ac0757a974349160aa795b45451948db6">LOB::Side</a></div><div class="ttdeci">Side</div><div class="ttdoc">the possible sides for the LimitTree</div><div class="ttdef"><b>Definition:</b> structures.hpp:35</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_acbdb9e8e207eed2924ef09c4b49472a6"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#acbdb9e8e207eed2924ef09c4b49472a6">LOB::LimitOrderBook::price</a></div><div class="ttdeci">Price price() const</div><div class="ttdoc">Return the current price of the asset.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:249</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a47a0fe3f7ac4da1b6ce80e0902ef0473"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a47a0fe3f7ac4da1b6ce80e0902ef0473">LOB::LimitOrderBook::get</a></div><div class="ttdeci">const Order &amp; get(UID order_id)</div><div class="ttdoc">Get the order with given ID.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:135</div></div>
<div class="ttc" id="astruct_l_o_b_1_1_limit_tree_html_ae52da1196e73a756b93634df3940dcaa"><div class="ttname"><a href="struct_l_o_b_1_1_limit_tree.html#ae52da1196e73a756b93634df3940dcaa">LOB::LimitTree::count_at</a></div><div class="ttdeci">Count count_at(Price price) const</div><div class="ttdoc">Return the number of orders at the given limit price.</div><div class="ttdef"><b>Definition:</b> limit_tree.hpp:312</div></div>
<div class="ttc" id="anamespace_l_o_b_html_a482ac950a9cb23fdb93c66d6117a8f74"><div class="ttname"><a href="namespace_l_o_b.html#a482ac950a9cb23fdb93c66d6117a8f74">LOB::UID</a></div><div class="ttdeci">uint64_t UID</div><div class="ttdoc">a type for order IDs</div><div class="ttdef"><b>Definition:</b> structures.hpp:47</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a25db4d825c1f8504e8be5dae532dbb87"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a25db4d825c1f8504e8be5dae532dbb87">LOB::LimitOrderBook::clear</a></div><div class="ttdeci">void clear()</div><div class="ttdoc">Clear all the orders in the book.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:57</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a387f091324bb052d38c8532ab508ab7c"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a387f091324bb052d38c8532ab508ab7c">LOB::LimitOrderBook::best</a></div><div class="ttdeci">Price best(Side side) const</div><div class="ttdoc">Return the best price for the given side.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:238</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a7b2ad9b29403af9a5079176aefb009ce"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a7b2ad9b29403af9a5079176aefb009ce">LOB::LimitOrderBook::best_buy</a></div><div class="ttdeci">Price best_buy() const</div><div class="ttdoc">Return the best buy price.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:227</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a13a16e7cee3c24cf0d80b84440d7f7ac"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a13a16e7cee3c24cf0d80b84440d7f7ac">LOB::LimitOrderBook::count</a></div><div class="ttdeci">Count count() const</div><div class="ttdoc">Return the total number of orders in the book.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:380</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a7b32433cbe16525043683dd76b5eebc4"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a7b32433cbe16525043683dd76b5eebc4">LOB::LimitOrderBook::count_buy</a></div><div class="ttdeci">Count count_buy() const</div><div class="ttdoc">Return the total number of orders on the buy side of the book.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:374</div></div>
<div class="ttc" id="anamespace_l_o_b_html_a0860e916768a8e3baaadf73c1a6f9c58"><div class="ttname"><a href="namespace_l_o_b.html#a0860e916768a8e3baaadf73c1a6f9c58">LOB::Volume</a></div><div class="ttdeci">uint64_t Volume</div><div class="ttdoc">a type for limit total volume</div><div class="ttdef"><b>Definition:</b> structures.hpp:90</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a467bc9491b867ec41ae85a1b93953717"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a467bc9491b867ec41ae85a1b93953717">LOB::LimitOrderBook::count_at</a></div><div class="ttdeci">Count count_at(Price price) const</div><div class="ttdoc">Return the total number of orders at the given limit price.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:360</div></div>
<div class="ttc" id="astruct_l_o_b_1_1_order_html"><div class="ttname"><a href="struct_l_o_b_1_1_order.html">LOB::Order</a></div><div class="ttdoc">A single order in the LimitOrderBook.</div><div class="ttdef"><b>Definition:</b> structures.hpp:57</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a7d1612e63e88d3dc75046d3d653f1312"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a7d1612e63e88d3dc75046d3d653f1312">LOB::LimitOrderBook::volume_buy</a></div><div class="ttdeci">Volume volume_buy(Price price) const</div><div class="ttdoc">Return the total volume for the buy side of the book.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:321</div></div>
<div class="ttc" id="astruct_l_o_b_1_1_limit_tree_html_ac4a8791f4b50ed29152d42940c3be06d"><div class="ttname"><a href="struct_l_o_b_1_1_limit_tree.html#ac4a8791f4b50ed29152d42940c3be06d">LOB::LimitTree::limit</a></div><div class="ttdeci">void limit(Order *order)</div><div class="ttdoc">Place a limit order on the limit tree.</div><div class="ttdef"><b>Definition:</b> limit_tree.hpp:189</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_aba2ae20f97a5e485dc04c7eee730b877"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#aba2ae20f97a5e485dc04c7eee730b877">LOB::LimitOrderBook::volume_buy_best</a></div><div class="ttdeci">Volume volume_buy_best() const</div><div class="ttdoc">Return the volume at the best sell price.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:335</div></div>
<div class="ttc" id="astruct_l_o_b_1_1_limit_tree_html_a1098e1bb85b42a2e7ea550a8a3a7d56b"><div class="ttname"><a href="struct_l_o_b_1_1_limit_tree.html#a1098e1bb85b42a2e7ea550a8a3a7d56b">LOB::LimitTree::cancel</a></div><div class="ttdeci">void cancel(Order *order)</div><div class="ttdoc">Remove an order from the limit tree.</div><div class="ttdef"><b>Definition:</b> limit_tree.hpp:227</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a921ec224ef6f9b7f3033f8d56b452da6"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a921ec224ef6f9b7f3033f8d56b452da6">LOB::LimitOrderBook::last_best_sell</a></div><div class="ttdeci">Price last_best_sell() const</div><div class="ttdoc">Return the last best sell price.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:264</div></div>
<div class="ttc" id="anamespace_l_o_b_html_a98c8cdadc7da7cd760e1a6dede850854"><div class="ttname"><a href="namespace_l_o_b.html#a98c8cdadc7da7cd760e1a6dede850854">LOB::Count</a></div><div class="ttdeci">uint32_t Count</div><div class="ttdoc">a type for limit price order counts</div><div class="ttdef"><b>Definition:</b> structures.hpp:88</div></div>
<div class="ttc" id="astruct_l_o_b_1_1_limit_tree_html_a941d1cf3065746647e08bb972f65121b"><div class="ttname"><a href="struct_l_o_b_1_1_limit_tree.html#a941d1cf3065746647e08bb972f65121b">LOB::LimitTree::last_best_price</a></div><div class="ttdeci">Price last_best_price</div><div class="ttdoc">the last best price</div><div class="ttdef"><b>Definition:</b> limit_tree.hpp:165</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a967430745df666a98b00d169bf14cee3"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a967430745df666a98b00d169bf14cee3">LOB::LimitOrderBook::has</a></div><div class="ttdeci">bool has(UID order_id) const</div><div class="ttdoc">Return true if the book has an order with given ID, false otherwise.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:128</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a0701f5738fba67af36a47983c38dd9c1"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a0701f5738fba67af36a47983c38dd9c1">LOB::LimitOrderBook::limit</a></div><div class="ttdeci">void limit(Side side, UID order_id, Quantity quantity, Price price)</div><div class="ttdoc">Add a new order to the book.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:116</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a1c7a81804946e116e376c550154a092d"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a1c7a81804946e116e376c550154a092d">LOB::LimitOrderBook::market</a></div><div class="ttdeci">void market(Side side, UID order_id, Quantity quantity)</div><div class="ttdoc">Execute a market order.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:206</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a23f833cfd794e37a0eb0dc0d1518b832"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a23f833cfd794e37a0eb0dc0d1518b832">LOB::LimitOrderBook::volume_buy</a></div><div class="ttdeci">Volume volume_buy() const</div><div class="ttdoc">Return the total volume for the buy side of the book.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:329</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a64a58b51c467ef7ffcf97d806f5282ca"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a64a58b51c467ef7ffcf97d806f5282ca">LOB::LimitOrderBook::market_buy</a></div><div class="ttdeci">void market_buy(UID order_id, Quantity quantity)</div><div class="ttdoc">Execute a buy market order.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:195</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_ac03f86cfcc50a37b72c6d7f443c57123"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#ac03f86cfcc50a37b72c6d7f443c57123">LOB::LimitOrderBook::volume_sell_best</a></div><div class="ttdeci">Volume volume_sell_best() const</div><div class="ttdoc">Return the volume at the best sell price.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:311</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a38ef9caa257416d0290749d3e33662e8"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a38ef9caa257416d0290749d3e33662e8">LOB::LimitOrderBook::volume</a></div><div class="ttdeci">Volume volume() const</div><div class="ttdoc">Return the total volume for the book.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:353</div></div>
<div class="ttc" id="astruct_l_o_b_1_1_limit_tree_html_af889225100ab93c596081ceec4ffb474"><div class="ttname"><a href="struct_l_o_b_1_1_limit_tree.html#af889225100ab93c596081ceec4ffb474">LOB::LimitTree::clear</a></div><div class="ttdeci">void clear()</div><div class="ttdoc">Clear all the limits in the tree.</div><div class="ttdef"><b>Definition:</b> limit_tree.hpp:172</div></div>
<div class="ttc" id="astruct_l_o_b_1_1_limit_tree_html_a8dd611700d87618f14fdada0113272a5"><div class="ttname"><a href="struct_l_o_b_1_1_limit_tree.html#a8dd611700d87618f14fdada0113272a5">LOB::LimitTree::market</a></div><div class="ttdeci">void market(Order *order, Callback did_fill)</div><div class="ttdoc">Perform a market order of given quantity on the given limit tree.</div><div class="ttdef"><b>Definition:</b> limit_tree.hpp:266</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_af94adea77f7dad19b4dd061d69a96d91"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#af94adea77f7dad19b4dd061d69a96d91">LOB::LimitOrderBook::cancel</a></div><div class="ttdeci">void cancel(UID order_id)</div><div class="ttdoc">Cancel an existing order in the book.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:141</div></div>
<div class="ttc" id="astruct_l_o_b_1_1_limit_tree_html"><div class="ttname"><a href="struct_l_o_b_1_1_limit_tree.html">LOB::LimitTree&lt; Side::Sell &gt;</a></div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html">LOB::LimitOrderBook</a></div><div class="ttdoc">An order book for managing Limit / Order objects in a continuous double auction.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:43</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a7eade388226acdf65eb9804e90339cc3"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a7eade388226acdf65eb9804e90339cc3">LOB::LimitOrderBook::volume_sell</a></div><div class="ttdeci">Volume volume_sell() const</div><div class="ttdoc">Return the total volume for the sell side of the book.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:305</div></div>
<div class="ttc" id="astruct_l_o_b_1_1_limit_tree_html_ac6f9f6989f2d73a1917c1488252cfaf5"><div class="ttname"><a href="struct_l_o_b_1_1_limit_tree.html#ac6f9f6989f2d73a1917c1488252cfaf5">LOB::LimitTree::count</a></div><div class="ttdeci">Count count</div><div class="ttdoc">the total number of active orders for this tree</div><div class="ttdef"><b>Definition:</b> limit_tree.hpp:167</div></div>
<div class="ttc" id="anamespace_l_o_b_html_a1d5eee8595d35bc6f2b8372e44cd8dd7"><div class="ttname"><a href="namespace_l_o_b.html#a1d5eee8595d35bc6f2b8372e44cd8dd7">LOB::Quantity</a></div><div class="ttdeci">uint32_t Quantity</div><div class="ttdoc">a type for order quantities</div><div class="ttdef"><b>Definition:</b> structures.hpp:49</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_abc553a89a69dba889a5d338645376dce"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#abc553a89a69dba889a5d338645376dce">LOB::LimitOrderBook::market_sell</a></div><div class="ttdeci">void market_sell(UID order_id, Quantity quantity)</div><div class="ttdoc">Execute a sell market order.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:185</div></div>
<div class="ttc" id="astruct_l_o_b_1_1_limit_tree_html_a8d6aec814919b377fffeecd6c3919b83"><div class="ttname"><a href="struct_l_o_b_1_1_limit_tree.html#a8d6aec814919b377fffeecd6c3919b83">LOB::LimitTree::volume_at</a></div><div class="ttdeci">Volume volume_at(Price price) const</div><div class="ttdoc">Return the volume of orders at the given limit price.</div><div class="ttdef"><b>Definition:</b> limit_tree.hpp:302</div></div>
<div class="ttc" id="anamespace_l_o_b_html_a55b6f5940501ff6a6f8de06dfc18852c"><div class="ttname"><a href="namespace_l_o_b.html#a55b6f5940501ff6a6f8de06dfc18852c">LOB::UIDOrderMap</a></div><div class="ttdeci">std::unordered_map&lt; UID, Order &gt; UIDOrderMap</div><div class="ttdoc">a map of order IDs to orders</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:36</div></div>
<div class="ttc" id="astruct_l_o_b_1_1_limit_tree_html_a2295552bf2ed740a479ce87eb25594e0"><div class="ttname"><a href="struct_l_o_b_1_1_limit_tree.html#a2295552bf2ed740a479ce87eb25594e0">LOB::LimitTree::best</a></div><div class="ttdeci">Limit * best</div><div class="ttdoc">the best order</div><div class="ttdef"><b>Definition:</b> limit_tree.hpp:163</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a36759fa79596b1d2d9e2af07ab8954fd"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a36759fa79596b1d2d9e2af07ab8954fd">LOB::LimitOrderBook::LimitOrderBook</a></div><div class="ttdeci">LimitOrderBook()</div><div class="ttdoc">Initialize a new limit order book object.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:54</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_ac9b18049862c09ce70c87d679a83bd9f"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#ac9b18049862c09ce70c87d679a83bd9f">LOB::LimitOrderBook::volume</a></div><div class="ttdeci">Volume volume(Price price) const</div><div class="ttdoc">Return the volume at the given limit price.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:345</div></div>
<div class="ttc" id="anamespace_l_o_b_html_a0170482547b909e8a53b5ae42d18e23a"><div class="ttname"><a href="namespace_l_o_b.html#a0170482547b909e8a53b5ae42d18e23a">LOB::Price</a></div><div class="ttdeci">uint64_t Price</div><div class="ttdoc">a type for order prices</div><div class="ttdef"><b>Definition:</b> structures.hpp:51</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_abbc7458a5a780d29e57122bb4d233db5"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#abbc7458a5a780d29e57122bb4d233db5">LOB::LimitOrderBook::reduce</a></div><div class="ttdeci">void reduce(UID order_id, Quantity quantity)</div><div class="ttdoc">Reduce the quantity of the order with given ID.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:155</div></div>
<div class="ttc" id="astruct_l_o_b_1_1_limit_tree_html_a64a5025b0f65c36c1a6f2d4056543ea7"><div class="ttname"><a href="struct_l_o_b_1_1_limit_tree.html#a64a5025b0f65c36c1a6f2d4056543ea7">LOB::LimitTree::volume</a></div><div class="ttdeci">Volume volume</div><div class="ttdoc">the total volume of orders for this tree</div><div class="ttdef"><b>Definition:</b> limit_tree.hpp:169</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a3f67e339651390feb7171cea1bbd5c91"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a3f67e339651390feb7171cea1bbd5c91">LOB::LimitOrderBook::count_sell</a></div><div class="ttdeci">Count count_sell() const</div><div class="ttdoc">Return the total number of orders on the sell side of the book.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:368</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_ad69a10a7e1f026a2e055678b493533fa"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#ad69a10a7e1f026a2e055678b493533fa">LOB::LimitOrderBook::last_price</a></div><div class="ttdeci">Price last_price() const</div><div class="ttdoc">Return the current price of the asset using last prices.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:288</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_aa767c4ecce229b3393159ffd1cf481bb"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#aa767c4ecce229b3393159ffd1cf481bb">LOB::LimitOrderBook::volume_sell</a></div><div class="ttdeci">Volume volume_sell(Price price) const</div><div class="ttdoc">Return the total volume for the sell side of the book.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:297</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a8aba12b5f75a21fe026e85606cbca2fd"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a8aba12b5f75a21fe026e85606cbca2fd">LOB::LimitOrderBook::last_best</a></div><div class="ttdeci">Price last_best(Side side) const</div><div class="ttdoc">Return the best price for the given side.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:277</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_a5c93f74cfed393b21ef5b88787b95b79"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#a5c93f74cfed393b21ef5b88787b95b79">LOB::LimitOrderBook::limit_sell</a></div><div class="ttdeci">void limit_sell(UID order_id, Quantity quantity, Price price)</div><div class="ttdoc">Add a new sell limit order to the book.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:69</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_afd8dd7bccdcffee233c780fe445e1c01"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#afd8dd7bccdcffee233c780fe445e1c01">LOB::LimitOrderBook::best_sell</a></div><div class="ttdeci">Price best_sell() const</div><div class="ttdoc">Return the best sell price.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:217</div></div>
<div class="ttc" id="astruct_l_o_b_1_1_limit_html_a73fcec9f433efd6a506f1c08bf52a233"><div class="ttname"><a href="struct_l_o_b_1_1_limit.html#a73fcec9f433efd6a506f1c08bf52a233">LOB::Limit::volume</a></div><div class="ttdeci">Volume volume</div><div class="ttdoc">the total amount of volume at this limit price (sum of order shares)</div><div class="ttdef"><b>Definition:</b> structures.hpp:99</div></div>
<div class="ttc" id="aclass_l_o_b_1_1_limit_order_book_html_ac9bdd886adeb616798dab28ab8e07ab1"><div class="ttname"><a href="class_l_o_b_1_1_limit_order_book.html#ac9bdd886adeb616798dab28ab8e07ab1">LOB::LimitOrderBook::last_best_buy</a></div><div class="ttdeci">Price last_best_buy() const</div><div class="ttdoc">Return the last best buy price.</div><div class="ttdef"><b>Definition:</b> limit_order_book.hpp:270</div></div>
<!-- HTML footer for doxygen 1.8.18-->
<!-- start footer part -->
</body>
</html>
